package com.fzu.orderservice.client;

import com.fzu.commonutil.entity.Company;
import com.fzu.commonutil.entity.ServiceType;
import com.fzu.commonutil.entity.User;
import com.fzu.commonutil.params.DemandMatchParam;
import com.fzu.commonutil.params.ListParams;
import com.fzu.commonutil.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;
import java.util.Map;

@FeignClient(name = "normal-service", url = "http://127.0.0.1:18083")
public interface NormalClient {

    /**
     * 解析token获取用户信息
     * @param token
     * @return
     */
    @GetMapping("/api/user/decode")
    User decode(@RequestParam String token);

    /**
     * 获取家政员详情
     * @param id
     * @return
     */
    @GetMapping("/api/housekeeper/detail/{id}")
    R housekeeperDetail(@PathVariable("id") Integer id);

    /**
     * 获取家政员信息
     * @param id
     * @return
     */
    @GetMapping("/api/housekeeper/info/{id}")
    R housekeeperInfo(@PathVariable("id") Integer id);


    /**
     * 获取需求信息
     * @param id
     * @return
     */
    @GetMapping("/api/demand/info/{id}")
    R demandInfo(@PathVariable("id") Integer id);

    /**
     * 获取地址簿信息
     * @param id
     * @return
     */
    @GetMapping("/api/address-book/info/{id}")
    R addressBookInfo(@PathVariable("id") Integer id);


    /**
     * 获取公司ID-entity Map
     * @param params
     * @return
     */
    @PostMapping("/api/company/map")
    Map<Integer, String> companyMap(@RequestBody ListParams params);


    /**
     * 获取公司详情
     * @param id
     * @return
     */
    @GetMapping("/api/company/detail/{id}")
    R companyDetail(@PathVariable("id") Integer id);


    /**
     * 获取服务类型详情
     * @param id
     * @return
     */
    @GetMapping("/api/service-type/detail/{id}")
    R serviceTypeDetail(@PathVariable("id") Integer id);

    /**
     * 获取所有服务类型
     * @return
     */
    @GetMapping("/api/service-type/listAll")
    List<ServiceType> serviceTypeAll();


    /**
     * 需求匹配完成
     * @param param
     * @return
     */
    @PutMapping("/api/demand/match")
    R match(@RequestBody DemandMatchParam param);

    /**
     * 获取所有公司
     * @return
     */
    @GetMapping("/api/company/all")
    List<Company> allCompany();
}
